<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta content="telephone=no,email=no,address=no" name="format-detection" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta name="msapplication-tap-highlight" content="no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="is_webp" content="yes" />
		<title>支付宝绑定</title>
		<meta name="Keywords" content="用户中心" />
		<meta name="Description" content="用户中心" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="__TMPL__Public/css/common.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/user.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/public.css" />
		<style>
			body,
			input,
			button,
			textarea,
			select,
			option {
				font-family: Helvetica, Tahoma, Arial, "Hiragino Sans GB", "Hiragino Sans GB W3", STXihei, STHeiti, "Microsoft YaHei", Heiti, SimSun, sans-serif;
			}
			
			.list-footer {
				background: red;
			}
			
			.list-footer a {
				color: #fff;
			}
			
			#add-address-div {
				display: none;
			}
			
			.addressmone1 .save_btn.ok .btn {
				background: red;
			}
			
			input {
				font: 13.3333px Arial;
			}
			
			#btn_submit {
				background: #f23030;
			}
			
			#rechargecardmodel-card_number-error {
				display: none;
			}
			
			.operat-tips .tips-info {
				height: 300px;
				overflow: auto;
			}
			.form-group dl dd input{color: #000;}
			.form-group dl dd .form-control-box{color: #666;}
		</style>
	</head>

	<body>

		<div>
			<?php
				$agent = $_SERVER['HTTP_USER_AGENT'];
				if(strpos($agent,"Html5Plus") === false){
			?>
			<header>
				<div class="header">
					<div class="header-left">
						<a class="sb-back" href="{:U('user/center')}" title="返回"></a>
					</div>
					<div class="header-middle">支付宝绑定</div>
					<div class="header-right">
						<aside class="show-menu-btn">
							<div id="show_more" class="show-menu">
								<a href="javascript:;"></a>
							</div>
						</aside>
					</div>
				</div>
			</header>
			<mtc_include file="Public:right_nav" />
			<?php
				}
			?>
			<style type="text/css">
				.form-group dt{width: 110px!important;text-align: right;}
			</style>
          <php> if($userinfo['ali_number']==''||$userinfo['ali_name']==''){</php>
          	<style type="text/css">
				.bd_ali{display:block;}
                .ybd_ali{display:none;}
			</style>
          <php>}else{</php>
         	 <style type="text/css">
          		
               .bd_ali{display:none;}
                .ybd_ali{display:block;}
            </style>
           <php>}</php>
			<div class="middle-content recharge-card m-t-0 bd_ali">
					<div class="form-group form-group-spe">
						<dl>
							<dt>
							<span>支付宝账号：</span>
							</dt>
							<dd>
								<div class="form-control-box">
									<input type="text" name="ali_number" class="form-control ipt pull-none m-r-10" value="{$userinfo['ali_number']}">
								</div>
							</dd>
						</dl>
					</div>
					<div class="invalid"></div>
					
					<div class="form-group form-group-spe">
						<dl>
							<dt>
							<span>真实姓名：</span>
							</dt>
							<dd>
								<div class="form-control-box">
									<input type="text" name="ali_name" class="form-control ipt pull-none m-r-10" value="{$userinfo['ali_name']}">
								</div>
							</dd>
						</dl>
					</div>
					<div class="invalid"></div>
					
					<div class="form-group form-group-spe">
						<dl>
							<dt>
							<span>手机号：</span>
							</dt>
							<dd>
								<div class="form-control-box">
									{$userinfo['phone']}
								</div>
							</dd>
						</dl>
					</div>
					<div class="invalid"></div>
					
					
					<div class="form-group form-group-spe">
						<dl>
							<dt>
							<span>验证码：</span>
							</dt>
							<dd>
								<div class="form-control-box">
									<input type="text" name="code" class="form-control ipt pull-none m-r-10" >
									<a href="javascript:void(0);" class="phonecode" style="color: #000000;">获取短信校验码</a>
								</div>
							</dd>
						</dl>
					</div>
					<div class="invalid"></div>
					<div class="submit-btn">
						<a class="btn-submit ali_edit" id="btn_submit" type="submit" href="javascript:void(0)">确认提交</a>
					
					</div>
			</div>
          	<div class="middle-content recharge-card m-t-0 ybd_ali">
					<div class="form-group form-group-spe">
						<dl>
							<dt>
							<span>支付宝账号：</span>
							</dt>
							<dd>
								<div class="form-control-box">
									<input type="text" name="ali_number" class="form-control ipt pull-none m-r-10" value="{$userinfo['ali_number']}（已绑定）"  readonly="readonly" style="width: 130%;">
								</div>
							</dd>
						</dl>
					</div>
					<div class="invalid"></div>
					
					<div class="form-group form-group-spe">
						<dl>
							<dt>
							<span>真实姓名：</span>
							</dt>
							<dd>
								<div class="form-control-box">
									<input type="text" name="ali_name" class="form-control ipt pull-none m-r-10" value="{$userinfo['ali_name']}"  readonly="readonly">
								</div>
							</dd>
						</dl>
					</div>
					<div class="invalid"></div>
					
					
					
					
					<div class="invalid"></div>
					<div class="submit-btn">
						<a class="btn-submit edit_show" href="javascript:void(0)" style="background:red">点击修改</a>
					</div>
			</div>
		</div>

		</span>

		</div>

		</form>
		</div>
		<!-- 底部 _end-->
		<section class="mask-div"></section>
		<script type="text/javascript" src="/themes/wnsc_moblie/newMobile/User/js/area/jquery.min.js"></script>
		<script type="text/javascript" src="__TMPL__Public/js/common.js"></script>
		<script src="/themes/wnsc_moblie/newMobile/User/login/js/mobile/layer.js"></script>
		<link rel="stylesheet" href="/themes/wnsc_moblie/newMobile/Shop/css/dropload.css" />
		<script src="/themes/wnsc_moblie/newMobile/Shop/css/dropload.js"></script>
		<script type="text/javascript">
          $('.edit_show').click(function(){
          		$('.bd_ali').show();          		
                $('.ybd_ali').hide();

          })
			$('.ali_edit').click(function(){
				var ali_number=$('input[name=ali_number]').val();
				var ali_name=$('input[name=ali_name]').val();
				var code=$('input[name=code]').val();
				if(ali_number==''||ali_name==''||code==''){
					
					layer.open({
						    content:'请填写完整'
						    ,skin: 'msg'
						    ,time: 2 //2秒后自动关闭
						});
					return;
				}
				$.post('/user/ali', {
					ali_number: ali_number,
					ali_name: ali_name,
					code: code,
				}, function(result) {
					if(result==0){
						layer.open({
						    content:'保存成功'
						    ,skin: 'msg'
						    ,time: 2 //2秒后自动关闭
						});
						setTimeout("window.location.href='/user/center.html'",2000)
						return;
					}
					if(result==1){
						layer.open({
						    content:'保存成功'
						    ,skin: 'msg'
						    ,time: 2 //2秒后自动关闭
						});
						setTimeout("window.location.href='/user/center.html'",2000)
						return;
					}
					if(result==2){
						layer.open({
						    content:'验证码不正确'
						    ,skin: 'msg'
						    ,time: 2 //2秒后自动关闭
						});
						
						return;
					}
						
				}, "json");
			})
			// 获取验证码链接点击事件
			$(".phonecode").prop("disabled", false);
			$(".phonecode").click(function() {

				// 获取短信验证码
				var target = this;
				
				var mobile ="{$userinfo['phone']}";
				var type=$(this).prop("disabled");
			
				if(type==false){
					$.post('/user/sms_captcha_ali', {
						mobile: mobile,
					}, function(result) {
						if(result.code == 0) {
							
							layer.open({
							    content:result.message
							    ,skin: 'msg'
							    ,time: 2 //2秒后自动关闭
							});
						} else {
							// 开始倒计时
							countdown(target, "获取短信验证码");
							layer.open({
							    content:result.message
							    ,skin: 'msg'
							    ,time: 2 //2秒后自动关闭
							});
							
	
						}
						$(target).data("doing", false);
					}, "json");
				}
				
			});
			var wait = 60;

			function countdown(obj, msg) {
				obj = $(obj);

				if(wait <= 0) {
					obj.prop("disabled", false);
					obj.html(msg);
					wait = 60;
				} else {
					if(msg == undefined || msg == null) {
						msg = obj.html();
					}
					obj.prop("disabled", true);
					obj.html(wait + "秒后重新获取");
					wait--;
					setTimeout(function() {
						countdown(obj, msg)
					}, 1000)
				}
			}
		</script>

	</body>

</html>